// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   FuncLayoutDTO.java

package com.hfstu.ifs.dto;

import com.hfstu.framework.util.StringUtil;
import com.hfstu.ifs.model.*;
import java.lang.reflect.InvocationTargetException;
import java.util.Date;
import org.apache.commons.beanutils.BeanUtils;

// Referenced classes of package com.hfstu.ifs.dto:
//			ControlRegisterDTO

public class FuncLayoutDTO
{

	private String id;
	private Integer status;
	private Date createTime;
	private Date lastChangeTime;
	private String code;
	private String name;
	private String funcType;
	private String funcDefId;
	private String funcDefName;
	private String controlRegisterId;
	private String controlRegisterName;
	private ControlRegisterDTO controlRegisterDTO;
	private String dtoType;

	public FuncLayoutDTO()
	{
		status = Integer.valueOf(0);
		controlRegisterDTO = null;
		dtoType = "FuncLayoutDTO";
	}

	public String getId()
	{
		return id;
	}

	public void setId(String id)
	{
		this.id = id;
	}

	public Integer getStatus()
	{
		return status;
	}

	public void setStatus(Integer status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getLastChangeTime()
	{
		return lastChangeTime;
	}

	public void setLastChangeTime(Date lastChangeTime)
	{
		this.lastChangeTime = lastChangeTime;
	}

	public String getCode()
	{
		return code;
	}

	public void setCode(String code)
	{
		this.code = code;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getFuncType()
	{
		return funcType;
	}

	public void setFuncType(String funcType)
	{
		this.funcType = funcType;
	}

	public String getFuncDefId()
	{
		return funcDefId;
	}

	public void setFuncDefId(String funcDefId)
	{
		this.funcDefId = funcDefId;
	}

	public String getFuncDefName()
	{
		return funcDefName;
	}

	public void setFuncDefName(String funcDefName)
	{
		this.funcDefName = funcDefName;
	}

	public String getControlRegisterId()
	{
		return controlRegisterId;
	}

	public void setControlRegisterId(String controlRegisterId)
	{
		this.controlRegisterId = controlRegisterId;
	}

	public String getControlRegisterName()
	{
		return controlRegisterName;
	}

	public void setControlRegisterName(String controlRegisterName)
	{
		this.controlRegisterName = controlRegisterName;
	}

	public ControlRegisterDTO getControlRegisterDTO()
	{
		return controlRegisterDTO;
	}

	public void setControlRegisterDTO(ControlRegisterDTO controlRegisterDTO)
	{
		this.controlRegisterDTO = controlRegisterDTO;
	}

	public String getDtoType()
	{
		return dtoType;
	}

	public void setDtoType(String dtoType)
	{
		this.dtoType = dtoType;
	}

	public void transfer(FuncLayout funcLayout)
	{
		try
		{
			BeanUtils.copyProperties(this, funcLayout);
		}
		catch (IllegalAccessException e)
		{
			e.printStackTrace();
		}
		catch (InvocationTargetException e)
		{
			e.printStackTrace();
		}
		if (funcLayout.getFuncDef() != null)
		{
			setFuncDefId(funcLayout.getFuncDef().getId());
			setFuncDefName(funcLayout.getFuncDef().getName());
		}
		if (funcLayout.getControlRegister() != null)
		{
			setControlRegisterId(funcLayout.getControlRegister().getId());
			setControlRegisterName(funcLayout.getControlRegister().getName());
			setControlRegisterDTO((new ControlRegisterDTO()).transfer(funcLayout.getControlRegister()));
		}
	}

	public String toJson()
	{
		StringBuilder json = new StringBuilder();
		json.append("{");
		json.append("\"id\":\"").append(getId()).append("\",");
		json.append("\"code\":\"").append(getCode()).append("\",");
		json.append("\"name\":\"").append(getName()).append("\",");
		json.append("\"funcType\":\"").append(StringUtil.clean(getFuncType())).append("\",");
		json.append("\"dtoType\":\"").append(getDtoType()).append("\",");
		if (controlRegisterDTO == null)
			json.append("\"controlRegisterDTO\":{").append("}");
		else
			json.append("\"controlRegisterDTO\":").append(controlRegisterDTO.toJson()).append("");
		json.append("}");
		return json.toString();
	}
}
